#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int main()
{
	int m = 0;
	for (m = 10000; m <= 99999; m++)
	{
		int n = 0, sum = 0;
		for (n = 10; n <= 10000;n*= 10)
		{
			sum += (m/n) * (m%n);
		}
		if (sum==m)
		{
			printf("%d ", m);
		}
	}
	return 0;
}